home *** CD-ROM | disk | FTP | other *** search
/ Basic Instinct 2 Press Kit / Basic Instinct 2 Press Kit.iso / pc / main.dxr / Internal_118_Tracker222 Parent.ls < prev    next >
Encoding:
Text File  |  2006-03-15  |  10.1 KB  |  374 lines

  1. property pStatus, pMasterList, pCurrentSession, pMainScore, pFirstScore, pSlideShowScore, pTrailerScore, pPosterScore, pLogoScore, pNotesScore, pSaveScore, pSummaryScore, pGeneralList, pSectionList, pDownLoadList, pPhotoViewList, pFlashPaperViewList, pDSWPath, pDSWFolderExists, pFileName, pDSWFileExists, p12345, pFullPath, pTesterURL, pConnectedToInternet, pFlashSprite
  2. global gTracker, gMaster, gNetQueue, gRecordSet, gTempList
  3.  
  4. on new me
  5.   pTesterURL = "http://tracking.exposurelab.com/12345.txt"
  6.   p12345 = EMPTY
  7.   pConnectedToInternet = "no"
  8.   pGeneralList = [#sessionID: 0, #pkID: 0, #startDateTime: 0, #endDateTime: 0, #screenheight: 0, #screenwidth: 0, #screendepth: 0, #platform: 0]
  9.   pSectionList2 = [#main: 0, #first: 0, #gallery: 0, #slideshow: 0, #trailer: 0, #poster: 0, #logos: 0, #notes: 0, #summary: 0, #flashpaper: 0, #website: 0]
  10.   pSectionList = [:]
  11.   pDownLoadList = []
  12.   pPhotoViewList = []
  13.   pFlashPaperViewList = []
  14.   pStatus = "on"
  15.   pFileName = "stats.txt"
  16.   if the platform contains "Mac" then
  17.     vDisks = baDiskList()
  18.     pDSWPath = vDisks[1] & "dswMedia"
  19.   else
  20.     vDisks = baDiskList()
  21.     repeat with x = 1 to vDisks.count
  22.       if vDisks[x] contains "c" then
  23.         vTemp = vDisks[x]
  24.         exit repeat
  25.       end if
  26.     end repeat
  27.     pDSWPath = vTemp & "dswMedia"
  28.   end if
  29.   pDSWFolderExists = baFolderExists(pDSWPath)
  30.   if pDSWFolderExists = 1 then
  31.     vPath = pDSWPath & gMaster.pPlatformSymbol & pFileName
  32.     pDSWFileExists = baFileExists(vPath)
  33.   else
  34.     pDSWFileExists = 0
  35.   end if
  36.   pFullPath = pDSWPath & gMaster.pPlatformSymbol & pFileName
  37.   pFlashSprite = 200
  38.   pGeneralList.startDateTime = the date & " " & the long time
  39.   pGeneralList.screenheight = (the desktopRectList)[1][4]
  40.   pGeneralList.screenwidth = (the desktopRectList)[1][3]
  41.   pGeneralList.screendepth = (the environment).colorDepth
  42.   pGeneralList.platform = (the environment).platform
  43.   return me
  44. end
  45.  
  46. on stepFrame me
  47. end
  48.  
  49. on mCheckForPrevious me
  50.   if p12345 = EMPTY then
  51.     exit
  52.   else
  53.     if pDSWFileExists = 1 then
  54.     else
  55.       nothing()
  56.     end if
  57.   end if
  58. end
  59.  
  60. on mWrapUpTracker me
  61.   if (gMaster.pTracking = "False") or (gMaster.pTracking = "none") then
  62.     exit
  63.   end if
  64.   if p12345 = EMPTY then
  65.     vTempList = []
  66.     add(vTempList, pGeneralList)
  67.     add(vTempList, pSectionList)
  68.     add(vTempList, pDownLoadList)
  69.     add(vTempList, pPhotoViewList)
  70.     add(vTempList, pFlashPaperViewList)
  71.     if pDSWFileExists = 1 then
  72.       gTracker.mReadConvertAddReWrite(vTempList)
  73.     else
  74.       gTracker.mWriteString("[" & string(vTempList) & "]")
  75.     end if
  76.   else
  77.     gTracker.mDeleteFileFromFolder()
  78.   end if
  79. end
  80.  
  81. on mNoInterNetConnection me
  82.   if (gMaster.pTracking = "False") or (gMaster.pTracking = "none") then
  83.     exit
  84.   end if
  85.   if p12345 = EMPTY then
  86.     gTracker.pGeneralList.endDateTime = the date & " " & the long time
  87.     vTempList = []
  88.     add(vTempList, pGeneralList)
  89.     add(vTempList, pSectionList)
  90.     add(vTempList, pDownLoadList)
  91.     add(vTempList, pPhotoViewList)
  92.     add(vTempList, pFlashPaperViewList)
  93.     if pDSWFolderExists = 1 then
  94.       if pDSWFileExists = 1 then
  95.         gTracker.mReadConvertAddReWrite(vTempList)
  96.       else
  97.         gTracker.mWriteString("[" & string(vTempList) & "]")
  98.       end if
  99.     else
  100.       baCreateFolder(gTracker.pDSWPath)
  101.       gTracker.mWriteString("[" & string(vTempList) & "]")
  102.     end if
  103.   end if
  104. end
  105.  
  106. on mCheckInternetConnection me
  107.   gNetQueue.mGetNetText(pTesterURL, #mFileTheResults, gNetQueue)
  108.   gNetQueue.pStartTimer = the timer
  109.   gNetQueue.pStepframe = "waiting"
  110. end
  111.  
  112. on mReadConvertAddReWrite me, vlist
  113.   vString = gTracker.mReadFile()
  114.   gTempList = []
  115.   gTempList = value(vString)
  116.   vCount = gTempList.count
  117.   add(gTempList, vlist)
  118.   put string(gTempList)
  119.   gTracker.mDeleteFileFromFolder()
  120.   gTracker.mWriteString(string(gTempList))
  121. end
  122.  
  123. on mStartTracker me
  124. end
  125.  
  126. on mDeleteFileFromFolder me
  127.   Ok = baDeleteFile(pFullPath)
  128.   pDSWFileExists = 0
  129. end
  130.  
  131. on mReadFile me
  132.   myFile = new(xtra("fileIO"))
  133.   fileName = gTracker.pFullPath
  134.   if fileName <> EMPTY then
  135.     myFile.openfile(fileName, 1)
  136.     vTempString = myFile.readFile()
  137.   end if
  138.   vTempList = []
  139.   vTempList = value(vTempString)
  140.   put "vTempList count: " & vTempList.count
  141.   myFile.closeFile()
  142.   if offset("&", vTempString) > 0 then
  143.     vTempString = "[" & vTempString & "]"
  144.     mainText = vTempString
  145.   else
  146.     mainText = vTempString
  147.   end if
  148.   myFile = 0
  149.   return mainText
  150. end
  151.  
  152. on mReadStoredData me
  153.   myFile = new(xtra("fileIO"))
  154.   fileName = gTracker.pFullPath
  155.   if fileName <> EMPTY then
  156.     myFile.openfile(fileName, 1)
  157.     vTempString = myFile.readFile()
  158.   end if
  159.   vTempList = []
  160.   vTempList = value(vTempString)
  161.   gRecordSet.pMasterList = vTempList
  162.   myFile.closeFile()
  163.   myFile = 0
  164.   gRecordSet.mProcessStoredRecordSet()
  165. end
  166.  
  167. on mReplaceText me, mainText, SearchString, replaceString
  168.   theReplaceLen = SearchString.length - 1
  169.   charStart = offset(SearchString, mainText)
  170.   repeat while charStart <> 0
  171.     if charStart <> 0 then
  172.       put replaceString into mainText.char[charStart..charStart + theReplaceLen]
  173.       charStart = offset(SearchString, mainText)
  174.       next repeat
  175.     end if
  176.     put SearchString && "not found in text"
  177.   end repeat
  178.   return mainText
  179. end
  180.  
  181. on mAddPhotoView me, vWhichPhoto
  182.   pPhotoViewList.add(vWhichPhoto)
  183. end
  184.  
  185. on mAddFlashPaperView me, vWhichFlashPaper
  186.   pFlashPaperViewList.add(vWhichFlashPaper)
  187. end
  188.  
  189. on mAddDownLoad me, vType, vName
  190.   if (vType = "doc") or (vType = "pdf") then
  191.     case gMaster.pLanguageMode of
  192.       "english":
  193.         vType = "E" & vType
  194.       "spanish":
  195.         vType = "S" & vType
  196.     end case
  197.   end if
  198.   vlist = [vType, vName]
  199.   pDownLoadList.add(vlist)
  200. end
  201.  
  202. on mPutListsToString me
  203.   global gTempList
  204.   vText = "[" & string(pGeneralList) & ", " & string(pSectionList) & ", " & string(pDownLoadList) & ", " & string(pPhotoViewList) & "]"
  205.   gTempList = []
  206.   gTempList = value(vText)
  207.   put gTempList & RETURN & RETURN
  208.   put gTempList[1] & RETURN & RETURN
  209.   put gTempList[2] & RETURN & RETURN
  210.   put gTempList[3] & RETURN & RETURN
  211.   put gTempList[4] & RETURN & RETURN
  212. end
  213.  
  214. on mAddSection me, vWhichSection
  215.   case vWhichSection of
  216.     "main":
  217.       vCount = pSectionList.main
  218.       pSectionList.main = vCount + 1
  219.     "first":
  220.       vCount = pSectionList.first
  221.       pSectionList.first = vCount + 1
  222.     "1g", "2g", "3g", "4g", "5g", "6g", "7g", "8g", "9g", "10g":
  223.       vCount = pSectionList.gallery
  224.       pSectionList.gallery = vCount + 1
  225.     "slideshow":
  226.       vCount = pSectionList.slideshow
  227.       pSectionList.slideshow = vCount + 1
  228.     "trailer":
  229.       vCount = pSectionList.trailer
  230.       pSectionList.trailer = vCount + 1
  231.     "poster":
  232.       vCount = pSectionList.poster
  233.       pSectionList.poster = vCount + 1
  234.     "logos":
  235.       vCount = pSectionList.logos
  236.       pSectionList.logos = vCount + 1
  237.     "notes":
  238.       vCount = pSectionList.notes
  239.       pSectionList.notes = vCount + 1
  240.     "save1", "save2", "save3":
  241.       vCount = pSectionList.summary
  242.       pSectionList.summary = vCount + 1
  243.     "website":
  244.       vCount = pSectionList.website
  245.       pSectionList.website = vCount + 1
  246.   end case
  247. end
  248.  
  249. on mWriteString me, vString
  250.   vFileIOObj = 0
  251.   vFileIOObj = new(xtra("fileIO"))
  252.   if the platform contains "mac" then
  253.     setFilterMask(vFileIOObj, "TEXT")
  254.   else
  255.     setFilterMask(vFileIOObj, "Text Files,*.txt,All Files,*.*")
  256.   end if
  257.   createFile(vFileIOObj, pFullPath)
  258.   openfile(vFileIOObj, pFullPath, 0)
  259.   yyy = writeString(vFileIOObj, vString)
  260.   closeFile(vFileIOObj)
  261.   vFileIOObj = 0
  262. end
  263.  
  264. on mAppendString me, vString
  265.   vString2 = "&" & vString
  266.   vFileIOObj = new(xtra("fileIO"))
  267.   if the platform contains "mac" then
  268.     setFilterMask(vFileIOObj, "TEXT")
  269.   else
  270.     setFilterMask(vFileIOObj, "Text Files,*.txt,All Files,*.*")
  271.   end if
  272.   openfile(vFileIOObj, pFullPath, 0)
  273.   setPosition(vFileIOObj, getLength(vFileIOObj))
  274.   writeString(vFileIOObj, vString2)
  275.   closeFile(vFileIOObj)
  276.   vFileIOObj = 0
  277. end
  278.  
  279. on mWriteDataOLD me
  280.   global gMasterFolder
  281.   fileObj2 = new(xtra("fileIO"))
  282.   vPath = the moviePath
  283.   vTemp = vPath & "Captions.txt"
  284.   vTemp2 = vPath & "Captions.txt"
  285.   if the platform contains "Mac" then
  286.     vDisks = baDiskList()
  287.   else
  288.     vDisks = baDiskList()
  289.   end if
  290.   vDisks = baDiskList()
  291.   pSystemFolderPath = baSysFolder("system")
  292.   pDSWMediaPath = pSystemFolderPath & "dswmedia"
  293.   vOK = 0
  294.   if baFileExists(vTemp) = 1 then
  295.     vOK = 1
  296.   else
  297.     vOK = 0
  298.   end if
  299.   if vOK = 1 then
  300.     vMasterPath = gMasterFolder
  301.   else
  302.     if baFileExists(vTemp2) = 1 then
  303.       vOK = 2
  304.       vMasterPath = gMasterFolder
  305.     else
  306.       vOK = 0
  307.       vMasterPath = gMasterFolder
  308.     end if
  309.   end if
  310.   case vOK of
  311.     0:
  312.       saveText2(vTemp2, gMaster.pCaption1, gMaster.pCaption2, gMaster.pCaption3)
  313.     1, 2:
  314.       openfile(fileObj2, vTemp2, 0)
  315.       if status(fileObj2) <> 0 then
  316.         err = error(fileObj2, status(fileObj2))
  317.         alert("Error:" && err)
  318.         return EMPTY
  319.       end if
  320.       vText = readFile(fileObj2)
  321.       closeFile(fileObj2)
  322.       saveText1(vText, vTemp2, gMaster.pCaption3)
  323.   end case
  324. end
  325.  
  326. on mAddActor me
  327.   add(the actorList, me)
  328. end
  329.  
  330. on mDeleteActor me
  331.   where = getOne(the actorList, me)
  332.   if where > 0 then
  333.     deleteAt(the actorList, where)
  334.   end if
  335. end
  336.  
  337. on mSerializeRecordSet me
  338.   vFlashSprite = 200
  339.   vFieldsList = ["aaa", "bbb", "ccc"]
  340.   vFieldCount = vFieldsList.count
  341.   vRecordsList = [["111", "222", "333"], ["444", "555", "666"], ["777", "888", "999"]]
  342.   vRecordCount = vRecordsList.count
  343.   vFields = sprite(vFlashSprite).newObject("Array")
  344.   repeat with i = 1 to vFieldCount
  345.     vFields.push(vFieldsList[i])
  346.   end repeat
  347.   vRecordSet = newObject("RecordSet")
  348.   repeat with i = 1 to vRecordCount
  349.     vRecord = sprite(vFlashSprite).newObject("Object")
  350.     vCount = 0
  351.     repeat with j = 0 to vFieldCount - 1
  352.       vCount = vCount + 1
  353.       vFieldItem = vFieldsList[vCount]
  354.       vRecord.setProp(symbol(vFieldItem), vRecordsList[i][vCount])
  355.     end repeat
  356.     vRecordSet.addItem(vRecord)
  357.   end repeat
  358.   return vRecordSet
  359. end
  360.  
  361. on mSuperSectionName me, vName
  362.   addProp(pSectionList, vName, 0)
  363. end
  364.  
  365. on mAddSuperSectionView me, vWhichSection
  366.   vSymbol = vWhichSection
  367.   repeat with x = 1 to gTracker.pSectionList.count
  368.     if getPropAt(gTracker.pSectionList, x) = vSymbol then
  369.       gTracker.pSectionList[x] = gTracker.pSectionList[x] + 1
  370.       exit repeat
  371.     end if
  372.   end repeat
  373. end
  374.